package database.service;

import database.DAO.UserLoginStatusDAO;
import database.domain.UserLoginStatus;

public class UserLoginStatusService {
    UserLoginStatusDAO userLoginStatusDAO=new UserLoginStatusDAO();

    public Boolean queryUserLoginStatusByUserName(String userName){
        return (Boolean) userLoginStatusDAO.queryScalar(
                "select user_status from user_login_status where user_name=?",
                userName
        );
    }

    public int updateUserLoginStatusByUserName(String userName,Boolean isOnline){
        int status=isOnline?1:0;
        return userLoginStatusDAO.update(
                "update user_login_status set user_status=? where user_name=?",
                status,userName
        );
    }
}
